#include "yuvplayer.h"

YUVPlayer::YUVPlayer(QWidget *parent) : QWidget(parent)
{

}

YUVPlayer::~YUVPlayer()
{

    if(_yuvFileSpec) {

        delete  _yuvFileSpec;
        _yuvFileSpec = nullptr;
    }

    if(_inYUVFile) {

        delete _inYUVFile;
        _inYUVFile = nullptr;
    }

}

int YUVPlayer::init(YUVFileSpec &yuvFileSpec)
{

    this->_yuvFileSpec = new YUVFileSpec(yuvFileSpec);

    _inYUVFile = new QFile(yuvFileSpec.getFilePath());

    if(!_inYUVFile->open(QFile::ReadOnly)) {

        qDebug() << yuvFileSpec.getFilePath() << " error";
        return 1;
    }

    return 0;
}

void YUVPlayer::play()
{


}
